<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>文章列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../css/scroll-bar.css">
    <link rel="stylesheet" href="../css/sub-page.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_693759_wytlyqhtdtj1nhfr.css">
    <link rel="stylesheet" href="../lib/nprogress/nprogress.css">
</head>
<body>
<div class="ok-body">
    <!--面包屑导航区域-->
    <div class="ok-body-breadcrumb">
            <span class="layui-breadcrumb">
                <a><cite>首页</cite></a>
                <a><cite>修车进度</cite></a>
            </span>
        <a class="layui-btn layui-btn-small" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon layui-icon-refresh"></i>
        </a>
    </div>
    <!--模糊搜索区域-->
    <div class="layui-row">
        <form class="layui-form layui-col-md12 ok-search">
            <!--<input class="layui-input" placeholder="开始日期" autocomplete="off" id="startTime">
            <input class="layui-input" placeholder="截止日期" autocomplete="off" id="endTime">-->
            <input class="layui-input" placeholder="请输入用户名或者订单编号" autocomplete="off">
            <button class="layui-btn" lay-submit="" lay-filter="search">
                <i class="layui-icon layui-icon-search"></i>
            </button>
        </form>
    </div>
    <!--工具栏-->
    <okToolbar>
        <button class="layui-btn layui-btn-danger" id="batchDel">
            <i class="layui-icon layui-icon-delete"></i>批量删除
        </button>
        <span>共有数据：<i id="countNum"></i> 条</span>
    </okToolbar>
    <!--数据表格-->
    <table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
</div>
<!--js逻辑-->
<script src="../lib/layui/layui.js"></script>
<script src="../lib/nprogress/nprogress.js"></script>
<script src="../js/okadmin.js"></script>
<script>
    // 进度条加载提示
    NProgress.start();
    window.onload = function () {
        NProgress.done();
    }
    // layui相关
    layui.use(['element', 'table', 'form', 'jquery', 'laydate'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#startTime',
            type: "datetime"
        });

        laydate.render({
            elem: '#endTime',
            type: "datetime"
        });

        table.render({
            elem: '#tableId',
            url: 'http://function.516code.cn/functionPage/function/selectAllMaintenanceSchedule.do',
            limit: 10,
            page: true,
            even: true,
            cols: [[
                {type: 'checkbox'},
                {field: 'orderId', title: '订单编号', width: 100, sort: true},
                {field: 'orderTime', title: '订单时间', width: 192},
                {field: 'customerName', title: '客户姓名', width: 250},
                {field: 'carPlate', title: '车牌号', width: 120},
                {field: 'customerPhone', title: '联系方式', width: 200},
                {field: 'isTop', title: '维修情况', width: 115, templet: '#topTpl'},
                {field: 'status', title: '付款情况', width: 112, templet: '#statusTpl'},
               
            ]],
            done: function (res, curr, count) {
                $("#countNum").text(count);
            }
        });

        form.on('submit(search)', function () {
            layer.msg('正在查询，请稍后...');
            return false;
        });



        $("#batchDel").click(function () {
            layer.confirm("确定要批量删除吗？", {skin: 'layui-layer-lan', icon: 2, title: '提示', anim: 6}, function () {
                var checkStatus = table.checkStatus('tableId');
                var rows = checkStatus.data.length;
                if (rows > 0) {
                    var idsStr = "";
                    for (var i = 0; i < checkStatus.data.length; i++) {
                        idsStr += checkStatus.data[i].id + ',';
                    }
                    console.log("选择的id-->" + idsStr);
                    layer.msg("操作成功！", {icon: 1, time: 1000}, function () {
                        $(".layui-laypage-btn")[0].click();
                    });
                } else {
                    layer.msg('未选择有效数据', {
                        offset: 't',
                        anim: 6
                    });
                }
            });
        })

        $("#addUser").click(function () {
            layer.open({
                title: '添加文章',
                type: 2,
                shade: false,
                maxmin: true,
                shade: 0.5,
                anim: 4,
                area: ['90%', '90%'],
                content: 'article-add.html',
                zIndex: layer.zIndex,
                // skin: 'layui-layer-molv',
                end: function () {
                    $(".layui-laypage-btn")[0].click();
                }
            });
        })
    })
</script>
<!--模板-->
<!--<script type="text/html" id="urlTpl">
    <a href="{{d.url}}" target="_blank">{{d.url}}</a>
</script>-->
<script type="text/html" id="topTpl">
    <label  id ="label" name="isTop"   style="color: #{{ d.repairStatus== 2 ? '31b5dd' : 'bdccd1'}};" >{{d.repairStatus==2?'修理完成':'正在修理'}}</label>
</script>
<script type="text/html" id="statusTpl">
    <a id="{{d.orderStatus==2?'':'payment'}}payment"  href="{{ d.orderStatus== 2 ? 'javascript:;' : 'javascript:payment(19)'}}" style="color: #{{ d.orderStatus==2? 'bdccd1' : '31b5dd'}};text-decoration:{{d.orderStatus==2?'none':'underline'}} ;">{{d.orderStatus==2?'已付款':'未付款'}}</a>
</script>
</body>
</html>